This page last changed on Feb 25, 2009 by williams.

External Source Control Configuration

Note: The External source control block is available in CCNet build 1.3.0.3053 and later.

Typical / Minimal Configuration

For most uses the following is all you'll need in your ccnet.config:

<sourcecontrol type="external">
    <executable>path to command-line application</executable>
</sourcecontrol>

This will:

  • monitor for any changes in the workspace located at the project working directory, by passing GETMODS to the external executable
  • retrieve the lastest source when any changes are detected, by passing GETSOURCE to the external executable
  • apply a label to (i.e., make a snapshot of) the built files at the end of each successful build, by passing SETLABEL to the external executable

Full Configuration

<sourcecontrol type="external">
    <executable>path to command-line application</executable>
    <args>arguments for the command-line application</args>
    <autoGetSource>false</autoGetSource>
    <labelOnSuccess>false</labelOnSuccess>
    <environment>
        <var>name=value</var>
        <var>name=value</var>
        ...
    </environment>
    <timeout units="minutes">10</timeout>
</sourcecontrol>
Element Description Type Required Default
args Specifies the command line arguments to be passed to the source control command. string no ""
autoGetSource Specifies whether the current version of the source should be retrieved from the source control system. bool no false
environment Specifies any environment variables to set for the source control command complex no (none)
executable Specifies the path to the source control command. string yes  
labelOnSuccess Specifies whether or not CruiseControl.Net should ask the source control system to label the source when the build is successful. bool no false
timeout Sets the timeout period for the source control operation. See Timeout Configuration for details. Timeout no 10 minutes
issueUrlBuilder Converts the comment (or parts from it) into an url pointing to the issue for this build.
See Issue Builder for more details
Group N/A false

Operation

Each of the three sourcecontrol operations (GetModifications(), GetSource(), and LabelSourceControl()) are passed to the source control command as a command line.

GetModifications

The GetModifications function is invoked as the GETMODS operation, and specifying a starting and ending timestamp:

  • executable GETMODS "fromtimestamp" "totimestamp" args

The source control command should search for modifications between these two times inclusively, write their details to the standard output stream in the XML format used by the Modification Writer Task, and exit with exit status 0 (any other status indicates an error and will fail the build). For example, the following represents two modifications, numbered 12244 and 12245.

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfModification>
    <Modification>
        <ChangeNumber>12245</ChangeNumber>
        <Comment>New Project for testing stuff</Comment>
        <EmailAddress>JUser@Example.Com</EmailAddress>
        <FileName>AssemblyInfo.cs</FileName>
        <FolderName>Dev\Server\Interface\Properties\</FolderName>
        <ModifiedTime>2006-11-22T11:11:00-0500</ModifiedTime>
        <Type>add</Type>
        <UserName>joe_user</UserName>
        <Url>http://www.example.com/index.html</Url>
        <Version>5</Version>
    </Modification>
    <Modification>
        <ChangeNumber>12244</ChangeNumber>
        <Comment>New Project for accessing web services</Comment>
        <EmailAddress>SSpade@Example.Com</EmailAddress>
        <FileName>Interface</FileName>
        <FolderName>Dev\Server\</FolderName>
        <ModifiedTime>2006-11-22T11:10:44-0500</ModifiedTime>
        <Type>add</Type>
        <UserName>sam_spade</UserName>
        <Url>http://www.example.com/index.html</Url>
        <Version>4</Version>
    </Modification>
</ArrayOfModification>
GetSource

The GetSource function is invoked as the GETSOURCE operation, and specifying a working directory path and the target timestamp:

  • executable GETSOURCE "workingdirectory" "timestamp" args

The source control command should update the files in the specified working directory to the versions current as of the specified time stamp and exit with exit status 0 (any other status indicates an error and will fail the build).

LabelSourceControl

The LabelSourceControl function is invoked as the SETLABEL operation, and specifying a label to be applied and the target timestamp:

  • executable SETLABEL "label" "sourcetimestamp" args

The source control command should add the label to source repository and exit with exit status 0 (any other status indicates an error and will fail the build).

° Watch out for the comment tag, if this contains dodgy charatecters eg.: <   it will fail the getsource. Be sure to escape these characters.
  So replace these with there XML equivalents : <
° Be careful of the <ModifiedTime>, this MUST be more than the fromtimestamp if it is <= then the modification will not be detected.
° You don't need the following parameters for this to work:
             <Type />
             <FileName />
             <FolderName />
             <Version />
             <EmailAddress />


Document generated by Confluence on Mar 14, 2009 02:55